package io.persimmon.core.module.calculation.instance;

import io.persimmon.core.module.calculation.Calculation;

public class MinCalculation implements Calculation<Double, Number> {

    private double number = Double.MAX_VALUE;

    @Override
    public void accept(Number data) {
        if (number < data.doubleValue()) {
            number = data.doubleValue();
        }
    }

    @Override
    public Double calculationResult() {
        return number;
    }

    @Override
    public void clean() {
        number = Double.MAX_VALUE;
    }
}
